import { defineStore } from "pinia";

/** 系统配置 */
export const useAppStore = defineStore("app", {
  state: () => {
    return {
      /** 重新加载 */
      reload: true,
      /** 是否展开侧边栏菜单 */
      showAside: true,
      /** 是否内容区全屏 */
      contentFullScreen: false,
      /** 查看-每行几列-默认3 */
      column: 3,
      /** 是否手机端 */
      isPhone: false
    };
  },
  getters: {},
  actions: {
    setReload(data) {
      this.reload = data;
    },
    setShowAside(data) {
      this.showAside = data;
    },
    setContentFullScreen(data) {
      this.contentFullScreen = data;
    },
    setColumn(column) {
      this.column = column;
    },
    setIsPhone(data) {
      this.isPhone = data;
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        storage: window.localStorage,
      },
    ],
  },
});
